<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>小程序管理平台</title>
		<link rel="stylesheet" href="css/mui.min.css" />
		<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
		<script type="text/javascript" src="js/jquery.js" ></script>
		<script type="text/javascript" src="js/vue.js" ></script>
		<script src="https://unpkg.com/element-ui/lib/index.js"></script>
		<style>
			body {
				padding-bottom: 100px;
			}
			.mui-content {
				position: relative;
			}
			.mui-table-view {
				width: 120px;
				position: fixed;
				top: 10px;
				margin-top: 0px !important;
				margin-bottom: 0;
			    padding-left: 0;
			    list-style: none;
			    background-color: #fff;
			}
			.main-left {
				position: absolute;
				left: 125px;
				top: 10px;
				/*background-color: red;*/
				width: calc(100% - 130px);
				height: 200px;
			}
			.main-image {
				margin-bottom: 20px;
			}
			.title {
				height: 44px;
				line-height: 44px;
				background-color: #4975d5;
				width: 80%;
				font-weight: 200;
				font-size: 18px;
				color: white;
			}
			.title .shop_title {
				float: left;
			}
			.title .add_shop {
				float: right;
				margin-left: 30px;
				margin-right: 20px;
			}
			.add_shop button {
				margin-top: 8px;
			}
			.el-select {
				margin-left: 35px;
				height: 44px;
				width: 250px;
			}
			.el-select .el-input  {
				height: 44px;
			}
			.dia_form {
				width: 80%;
				margin: auto;
			}
			.dia_line .el-input{
				width: 80%;
			}
			.dia_line_btn {
				text-align: center;
				margin-top: 20px;
			}
			.el-dialog__headerbtn {
				display: none;
			}
			.el-dialog__header {
				text-align: center;
			}
			.image-table {
				width: 80%;
				text-align: center;
			}
			.image-input {
				width: 50%;
			}
			.table-title {
				height: 38px;
				line-height: 38px;
				background-color: white;
			}
			.table-line {
				height: 40px;
				line-height: 40px;
				background-color: white;
			}
			.line div {
				float: left;
			}
			.open-input {
				width: 50% !important;
			}
			.add {
				float: right;
				margin-right: 30px;
				margin-top: 10px;
				color: greenyellow;
			}
			.add:hover {
				cursor: pointer;
			}
			.pre_image,.pre_video {
				width: 120px;
				height: 100px;
			}
			.el-upload-list {
				display: none;
			}
			.but-area {
				width: 220px !important; 
			}
			.el-input__inner {
				margin: 0 !important;
			}
			.info-table td{
				height: 44px;
				line-height: 44px;
			}
			.info-table .el-button  {
				margin-top: 8px;
			}
			.el-range-separator {
				width: 22px !important;
			}
			.area .el-select {
				width: 160px;
				margin-left: 20px;
			}
			.tigong {
				/*position: fixed;*/
				width: 100%;
				height: 44px;
				line-height: 44px;
				margin-bottom: 20px;
				text-align: center;
			}
		</style>
	</head>
	<body>
		<div class="mui-content" id="app">
			<ul class="mui-table-view">
			    <li class="mui-table-view-cell" v-for="item in menu"><a v-bind:href="item.href">{{item.name}}</a></li>
			</ul>
			<div class="main-left">
				<!-- 店铺主图 -->
				<div id="main-image" class="main-image" v-loading="loading1">
					<div class="title">&nbsp;&nbsp;店铺主图</div>
					<table class="image-table" border="1" cellpadding="5" cellspacing="0">
						<tr class="table-title">
							<th>项目</th>
							<th>图片预览</th>
							<th>图片上传</th>
							<th>操作</th>
						</tr>
						<tr class="table-line">
							<td>店铺主图</td>
							<td>
								<img v-bind:src="pre_logo_image" id="pre_image_logo" class="pre_image" />
							</td>
							<td class="logo">
								<el-upload
								  accept="image/*"
								  class="upload-demo"
								  action="https://api.hgdqdev.cn/yaodian/upload"
								  list-type="picture"
								  :on-success="logoUploadSuccess"
								  :before-upload="befUpload1">
								  <el-button size="mini" type="primary">点击上传</el-button>
								  <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
								</el-upload>
							</td>
							<td class="but-area">
								<el-button v-on:click="save_logo" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
					</table>
				</div>
				<!-- 店铺信息 -->
				<div id="main-info" class="main-image">
					<div class="title">
						<div class="shop_title">&nbsp;&nbsp;店铺信息</div>
						<div class="add_shop">
							<el-button v-on:click="delete_shop" size="mini" type="danger" icon="el-icon-error">删除店铺</el-button>
							<el-button v-on:click="add_more_shop" size="mini" type="primary" icon="el-icon-plus">添加店铺</el-button>
						</div>
						<el-select v-model="shop_value" filterable placeholder="选择店铺" v-on:change="selectChange">
						    <el-option
						      v-for="item in options"
						      :key="item.id"
						      :label="item.name"
						      :value="item.id">
						    </el-option>
						 </el-select>
					</div>
					<table class="image-table info-table" border="1" cellpadding="5" cellspacing="0">
						<tr class="table-title"> 
							<th>项目</th>
							<th>编辑</th>
							<th>操作</th>
						</tr>
						<tr class="table-line">
							<td>公司地址</td>
							<td>
								<div class="area">
									省市区：
									<el-select size="mini" v-on:change="province_change" v-model="province_value" filterable placeholder="请选择省份">
									    <el-option
									      v-for="item in province"
									      :key="item.id"
									      :label="item.fullname"
									      :value="item.id">
									    </el-option>
									 </el-select>
									 <el-select size="mini" v-on:change="city_change" v-model="city_value" filterable placeholder="请选择城市">
									    <el-option
									      v-for="item in city"
									      :key="item.id"
									      :label="item.fullname"
									      :value="item.id">
									    </el-option>
									 </el-select>
									 <el-select v-show="is_show" size="mini" v-on:change="area_change" v-model="area_value" filterable placeholder="请选择区">
									    <el-option
									      v-for="item in areas"
									      :key="item.id"
									      :label="item.fullname"
									      :value="item.id">
									    </el-option>
									 </el-select>
								</div>
								详细地址
								<el-input v-model="address" style="width: 70%;" placeholder="请输入公司地址"></el-input>
								<div class="pre_address">{{pre_address}}</div>
							</td>
							<td>
								<el-button v-on:click="save_address_click" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
						<tr class="table-line">
							<td>营业时间</td>
							<td>
								<el-time-picker
								    is-range
								    v-model="open_time"
								    range-separator="至"
								    start-placeholder="开始时间"
								    end-placeholder="结束时间"
								    placeholder="选择时间范围"
								    value-format="HH:mm">
								 </el-time-picker>
							</td>
							<td>
								<el-button v-on:click="save_time_click" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
						<tr class="table-line">
							<td>联系方式</span></td>
							<td>
								<el-input v-model="contact" style="width: 70%;" placeholder="请输入联系方式"></el-input>
							</td>
							<td>
								<el-button v-on:click="save_contact_click" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
					</table>
				</div>
				<!-- 图片展示 -->
				<div id="main-shop" class="main-image" v-loading="loading2">
					<div class="title">&nbsp;&nbsp;图片展示<span v-on:click="add_image" class="add mui-icon mui-icon-plus"></div>
					<table id="show-image" class="image-table" border="1" cellpadding="5" cellspacing="0">
						<tr class="table-title">
							<th>序号</th>
							<th>图片预览</th>
							<th>图片上传</th>
							<th>操作</th>
						</tr>
						<tr class="table-line" v-for="(item,index) in show_images">
							<td>{{index + 1}}</td>
							<td>
								<img v-bind:id="index" class="pre_video" v-bind:src="item" />
							</td>
							<td>
								<el-upload 
								  accept="image/*"
								  :data="{id: index}"
								  class="upload-demo"
								  action="https://api.hgdqdev.cn/yaodian/upload"
								  list-type="picture"
								  :on-success="imageUploadSuccess"
								  :before-upload="befUpload2">
								  <el-button size="mini" type="primary">点击上传</el-button>
								  <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
								</el-upload>
							</td>
							<td>
								<el-button v-on:click="cancle_image(index)" size="mini" type="danger">删除<i class="el-icon-error el-icon--right"></i></el-button>
								<el-button v-on:click="save_image(index)" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
					</table>
				</div>
				<!-- 视频展示 -->
				<div id="main-video" class="main-image" v-loading="loading3">
					<div class="title">&nbsp;&nbsp;视频展示<span v-on:click="add_video" class="add mui-icon mui-icon-plus"></div>
					<table id="show-video" class="image-table" border="1" cellpadding="5" cellspacing="0">
						<tr class="table-title">
							<th>序号</th>
							<th>视频预览</th>
							<th>视频地址</th>
							<th>操作</th>
						</tr>
						<tr class="table-line" v-for="(item,index) in show_videos">
							<td>{{index + 1}}</td>
							<td>
								<video v-bind:id="index" class="pre_video" controls="controls" v-bind:src="item"></video>
							</td>
							<td>
								<el-input v-model="video_url" style="width: 70%;" placeholder="请输入视频地址"></el-input>
							</td>
							<td>
								<el-button v-on:click="cancle_video(index)" size="mini" type="danger">删除<i class="el-icon-error el-icon--right"></i></el-button>
								<el-button v-on:click="save_video(index)" size="mini" type="primary">保存<i class="el-icon-success el-icon--right"></i></el-button>
							</td>
						</tr>
					</table>
				</div>
				<div class="tigong">由四川鲸飞网络科技有限公司提供</div>
			</div>
			<!-- 添加药店 -->
		<el-dialog
		  title="添加药店"
		  :visible.sync="dialogVisible"
		  width="80%">
		  <div class="dia_form">
		  	<div class="dia_line">
			  	<label>药店名字&nbsp;&nbsp;&nbsp;</label>
			  	<el-input v-model="new_name" placeholder="请输入药店名字"></el-input>
			</div>
			<div class="dia_line_btn">
			  	<el-button type="primary" size="mini" @click="new_shop_click">确定</el-button>
    				<el-button @click="cancle_shop_click" size="mini">取消</el-button>
			</div>
		  </div>
		</el-dialog>
		</div>
	</body>
	<script>
		var app = new Vue({
			el: '#app',
			data: {
				pre_address: '',
				// 省份数据
				province: [],
				province_value: '',
				select_province: '',
				// 城市
				city_value: '',
				city: '',
				select_city: '',
				// 区
				area_value: '',
				areas: '',
				select_area: '',
				is_show: false,
				
				dialogVisible: false,
				new_name: '',
				options: [],
				// 选择的店铺ID
				shop_value: '',
				loading1: false,
				loading2: false,
				// 视频地址
				video_url: '',
				// 左边菜单栏
				menu: [
					{
						index: 0,
						name: '店铺主图',
						href: '#main-image'
					},
					{
						index: 1,
						name: '店铺信息',
						href: '#main-info'
					},
					{
						index: 2,
						name: '图片展示',
						href: '#main-shop'
					},
					{
						index: 3,
						name: '视频展示',
						href: '#main-video'
					},
					{
						index: 4,
						name: '操作指南',
						href: 'guide.html'
					}
				],
				// 店铺主图 预览
				pre_logo_image: '',
				// 展示 图片
				show_images: [],
				// 展示视频
				show_videos: [],
				// 地址
				address: '',
				// 营业时间
				open_time: '',
				// 联系方式
				contact:'',
			},
			watch:{
				start_time: function(val,oldVal){
					this.open_time = val + ' -- ' + this.end_time;
				},
				end_time: function(val,oldVal){
					this.open_time = this.start_time + ' -- ' + val;
				},
				select_province: function(val,oldVal){
					this.pre_address = 	val + this.select_city + this.select_area + this.address;
				},
				select_city: function(val,oldVal){
					this.pre_address = 	this.select_province + val + this.select_area + this.address;
				},
				select_area: function(val,oldVal){
					this.pre_address = 	this.select_province + this.select_city + val + this.address;
				},
				address: function(val,oldVal){
					this.pre_address = 	this.select_province + this.select_city + this.select_area + val;
				},
			},
			created: function(){
				this.getData();
			},
			methods: {
				// 省份选择
				province_change(e){
					var self = this;
					var len = this.province.length;
					for (var i = 0; i < len; i ++) {
						if (this.province[i].id == e) {
							this.select_province = this.province[i].fullname;
						}
					}
					$.ajax({
						type:"get",
						url:"https://api.hgdqdev.cn/yaodian/pc_yaodian_area",
						async:true,
						data: {
							provice_id: e
						},
						success: function(res){
							if (res.status == 100) {
								self.city = res.data;
							}else{
								self.$message.error('网络错误，请稍后刷新试试');
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					})
				},
				// 城市选择
				city_change(e){
					var self = this;
					var len = this.city.length;
					for (var i = 0; i < len; i ++) {
						if (this.city[i].id == e) {
							this.select_city = this.city[i].fullname;
						}
					}
					$.ajax({
						type:"get",
						url:"https://api.hgdqdev.cn/yaodian/pc_yaodian_area",
						async:true,
						data: {
							provice_id: e
						},
						success: function(res){
							if (res.status == 100) {
								if (res.data.length == 0) {
									self.is_show = false;
								} else{
									self.is_show = true;
									self.areas = res.data;
								}
							}else{
								self.$message.error('网络错误，请稍后刷新试试');
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					})
				},
				// 区域选择
				area_change(e){
					var len = this.areas.length;
					for (var i = 0; i < len; i ++) {
						if (this.areas[i].id == e) {
							this.select_area = this.areas[i].fullname;
						}
					}
					console.log(this.select_province);
					console.log(this.select_city);
					console.log(this.select_area);
				},
				// 添加店铺
				add_more_shop: function(){
					this.dialogVisible = true;
				},
				// 删除店铺
				delete_shop: function(){
					var self = this;
					var shop_value = this.shop_value;
					if (shop_value.length == 0 || shop_value == '') {
						this.$message({
				          message: '请先选择店铺!',
				          type: 'warning'
				       });
						return;
					}
					this.$confirm('此操作将永久删除该店铺, 是否继续?', '提示', {
			          confirmButtonText: '确定',
			          cancelButtonText: '取消',
			          type: 'warning'
			        }).then(() => {
			        		$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_del_shop",
							async:true,
							data: {
								shop_id: shop_value
							},
							success: function(res){
								if (res.status == 100) {
									self.options = res.shops;
									self.address = '';
									self.contact = '';
									self.open_time = [];
									self.$message({
							          message: '删除成功!',
							          type: 'success'
							        });
							        location.reload();
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
			        }).catch(() => {
			          this.$message({
			            type: 'info',
			            message: '已取消删除'
			          });          
			        });
				},
				// 确定添加
				new_shop_click: function(){
					var self = this;
					var new_name = this.new_name;
					if (new_name == 0) {
						this.$message({
				          message: '请输入店铺名字!',
				          type: 'warning'
				        });
						return;
					}
					$.ajax({
						type:"post",
						url:"https://api.hgdqdev.cn/yaodian/yaodian_new_shop",
						async:true,
						data: {
							name: new_name
						},
						success: function(res){
							if (res.status == 100) {
								self.dialogVisible = false;
								self.options = res.shops;
								self.$message({
						          message: '修改成功!',
						          type: 'success'
						        });
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					});
				},
				// 取消添加店铺
				cancle_shop_click: function(){
					this.dialogVisible = false;
				},
				befUpload1(file){
					this.loading1 = true;
				},
				befUpload2(file){
					this.loading2 = true;
				},
				befUpload3(file){
					this.loading3 = true;
				},
			     // 主图上传成功
			    logoUploadSuccess(response){
			      this.pre_logo_image = response.imageUrl;
			      this.loading1 = false;
			      if (response.status == 100) {
			      	this.$message({
			           message: '上传成功!',
			           type: 'success'
			         });
			      } else{
			      	this.$message.error('上传失败');
			      }
			    },
				// 保存主图
				save_logo: function(){
					var self = this;
					$.ajax({
						type:"post",
						url:"https://api.hgdqdev.cn/yaodian/yaodian_logo",
						async:true,
						data: {
							logo_image: this.pre_logo_image
						},
						success: function(res){
							if (res.status == 100) {
								self.$message({
						          message: '修改成功!',
						          type: 'success'
						        });
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					});
				},
				// 选择店铺
				selectChange(e){
					var len = this.options.length;
					for (var i = 0; i < len; i ++) {
						if (this.options[i].id == e) {
							this.select_province = this.options[i].province;
							this.select_city = this.options[i].city;
							this.select_area = this.options[i].sarea;
							this.address = this.options[i].address;
							this.contact = this.options[i].contact;
							this.open_time = [];
							this.open_time.push(this.options[i].open_time_start);
							this.open_time.push(this.options[i].open_time_end);
						}
					}
				},
				// 保存地址
				save_address_click: function(){
					var self = this;
					var address = this.address;
					var shop_value = this.shop_value;
					var select_province = this.select_province;
					var select_city = this.select_city;
					var select_area = this.select_area;
					if (shop_value.length == 0 || shop_value == '') {
						this.$message({
				          message: '请先选择店铺!',
				          type: 'warning'
				       });
						return;
					}
					if (select_province.length == 0 || select_province == '') {
						this.$message({
				          message: '请选择省份!',
				          type: 'warning'
				       });
						return;
					}
					if (select_city.length == 0 || select_city == '') {
						this.$message({
				          message: '请选择城市!',
				          type: 'warning'
				       });
						return;
					}
					if (this.is_show == true) {
						if (select_area.length == 0 || select_area == '') {
							this.$message({
					          message: '请选择区!',
					          type: 'warning'
					       });
							return;
						}
					}
					if (address.length == 0 || address == '') {
						this.$message({
				          message: '请输入店铺地址!',
				          type: 'warning'
				       });
						return;
					}
					$.ajax({
						type:"post",
						url:"https://api.hgdqdev.cn/yaodian/yaodian_address",
						async:true,
						data: {
							province: select_province,
							city: select_city,
							sarea: select_area,
							address: address,
							shop_id: shop_value
						},
						success: function(res){
							if (res.status == 100) {
								self.$message({
						          message: '修改成功!',
						          type: 'success'
						        });
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					});
				},
				// 保存时间
				save_time_click: function(){
					var self = this;
					var open_time = this.open_time;
					var start_time = open_time[0];
					var end_time =  open_time[1];
					var shop_value = this.shop_value;
					if (shop_value.length == 0 || shop_value == '') {
						this.$message({
				          message: '请先选择店铺!',
				          type: 'warning'
				       });
						return;
					}
					if (open_time.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_open",
							async:true,
							data: {
								start_time: start_time,
								end_time: end_time,
								shop_id: shop_value
							},
							success: function(res){
								if (res.status == 100) {
									self.$message({
							          message: '修改成功!',
							          type: 'success'
							        });
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请选择营业时间!',
				          type: 'warning'
				        });
						return;
					}
				},
				// 保存联系方式
				save_contact_click: function(){
					var self = this;
					var contact = this.contact;
					var shop_value = this.shop_value;
					if (shop_value.length == 0 || shop_value == '') {
						this.$message({
				          message: '请先选择店铺!',
				          type: 'warning'
				       });
						return;
					}
					if (contact.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_contact",
							async:true,
							data: {
								contact: contact,
								shop_id: shop_value
							},
							success: function(res){
								if (res.status == 100) {
									self.$message({
							          message: '修改成功!',
							          type: 'success'
							        });
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请输入联系方式!',
				          type: 'warning'
				        });
						return;
					}
				},
				// 展示图片上传成功
				imageUploadSuccess(response){
			      var index = response.index;
			      var imagePT = response.imageUrl
			      this.show_images[index] = response.imageUrl;
			      var domID = '#' + index;
			      this.loading2 = false;
			      $(domID).attr('src',imagePT);
			       if (response.status == 100) {
			      	this.$message({
			           message: '上传成功!',
			           type: 'success'
			         });
			      } else{
			      	self.$message.error('上传失败');
			      }
			   },
				// 保存图片
				save_image: function(e){
					var self = this;
					var index = e;
					var logo_image = self.show_images[index];
					if (logo_image.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_show_image",
							async:true,
							data: {
								logo_image: logo_image,
								index: index
							},
							success: function(res){
								if (res.status == 100) {
									self.$message({
							          message: '修改成功!',
							          type: 'success'
							        });
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请先上传图片!',
				          type: 'warning'
				        });
						return;
					}
				},
				// 删除图片
				cancle_image: function(e){
					var self = this;
					var index = e;
					var logo_image = self.show_images[index];
					if (logo_image.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_show_image_del",
							async:true,
							data: {
								logo_image: logo_image,
								index: index
							},
							success: function(res){
								if (res.status == 100) {
									var tempArr = self.show_images;
									var temp = [];
									for (var i = 0; i < tempArr.length; i ++) {
										if(i != index){
											temp.push(tempArr[i]);
										}
									}
									self.show_images = temp;
									self.$message({
							          message: '删除成功!',
							          type: 'success'
							        });
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请先上传图片!',
				          type: 'warning'
				        });
						return;
					}
				},
//				// 展示视频上传成功
//				videoUploadSuccess(response){
//				  this.loading3 = false;
//			      var index = response.index;
//			      var imagePT = response.imageUrl
//			      this.show_videos[index] = response.imageUrl;
//			      $($('video')[index]).attr('src',imagePT);
//			       if (response.status == 100) {
//			      	this.$message({
//			           message: '上传成功!',
//			           type: 'success'
//			         });
//			      } else{
//			      	self.$message.error('上传失败');
//			      }
//			   },
				// 保存视频
				save_video: function(e){
					var self = this;
					var index = e;
					var logo_image = self.video_url;
					if (logo_image.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_show_video",
							async:true,
							data: {
								logo_image: logo_image,
								index: index
							},
							success: function(res){
								if (res.status == 100) {
									self.$message({
							          message: '修改成功!',
							          type: 'success'
							        });
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请先上传图片!',
				          type: 'warning'
				        });
						return;
					}
				},
				// 删除视频
				cancle_video: function(e){
					var self = this;
					var index = e;
					var logo_image = self.show_videos[index];
					if (logo_image.length > 0) {
						$.ajax({
							type:"post",
							url:"https://api.hgdqdev.cn/yaodian/yaodian_show_video_del",
							async:true,
							data: {
								logo_image: logo_image,
								index: index
							},
							success: function(res){
								if (res.status == 100) {
									var tempArr = self.show_videos;
									var temp = [];
									for (var i = 0; i < tempArr.length; i ++) {
										if(i != index){
											temp.push(tempArr[i]);
										}
									}
									self.show_videos = temp;
									self.$message({
							          message: '删除成功!',
							          type: 'success'
							        });
								}else{
									self.$message.error('删除失败');
								}
							},
							error: function(){
								self.$message.error('网络错误，请稍后刷新试试');
							}
						});
					}else{
						self.$message({
				          message: '请先上传图片!',
				          type: 'warning'
				        });
						return;
					}
				},
				// 添加图片
				add_image: function(){
					this.show_images.push('');
				},
				// 添加视频
				add_video: function(){
					this.show_videos.push('');
				},
				getData: function(){
					var self = this;
					$.ajax({
						type:"get",
						url:"https://api.hgdqdev.cn/yaodian/pc_yaodian",
						async:true,
						success: function(res){
							if (res.status == 100) {
								// 店铺主图
								self.pre_logo_image = res.images;
								$('#pre_image_logo').attr('src',res.images);
								// 展示图片
								self.show_images = res.show_images;
								// 展示视频
								self.show_videos = res.show_videos;
								self.options = res.shops;
								self.province = res.province;
							} else{
								self.$message.error('网络错误，请稍后刷新试试');
							}
						},
						error: function(){
							self.$message.error('网络错误，请稍后刷新试试');
						}
					});
				},
			}
		})
	</script>
</html>
